<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function max(arr) {
            var max_arr = arr[0];
            for (var i = 0; i < arr.length; i++) {
                if (max_arr < arr[i]) {
                    max_arr = arr[i];
                }
            }
            return max_arr;
        }

        alert(max([3, 4, 7, 1, 9]));
    </script>
</head>

<body>

</body>

</html>